<template>
    <div class="app-container">
      <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
        <el-form-item label="上报时间">
        <el-date-picker
          v-model="daterangeReportingDate"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
        <!-- <el-form-item label="原纸卷号" prop="rollNumber">
          <el-input
            v-model="queryParams.rollNumber"
            placeholder="请输入原纸卷号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="设备ID" prop="machineryId">
          <el-input
            v-model="queryParams.machineryId"
            placeholder="请输入设备ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item> -->
        <el-form-item label="机台号" prop="machineryCode">
          <el-input
            v-model="queryParams.machineryCode"
            placeholder="请输入机台号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="设备名称" prop="machineryName">
          <el-input
            v-model="queryParams.machineryName"
            placeholder="请输入设备名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item> -->
        <el-form-item label="带班" prop="lead">
          <el-input
            v-model="queryParams.lead"
            placeholder="请输入带班"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="工单ID" prop="workorderId">
          <el-input
            v-model="queryParams.workorderId"
            placeholder="请输入工单ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item> -->
        <el-form-item label="工作单号" prop="workorderId">
          <el-input
            v-model="queryParams.workorderId"
            placeholder="请输入工作单号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="工单名称" prop="workorderName">
          <el-input
            v-model="queryParams.workorderName"
            placeholder="请输入工单名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item> -->
        <!-- <el-form-item label="产品ID" prop="itemId">
          <el-input
            v-model="queryParams.itemId"
            placeholder="请输入产品ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item> -->
        <el-form-item label="产品编号" prop="itemCode">
          <el-input
            v-model="queryParams.itemCode"
            placeholder="请输入产品编号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="产品名称" prop="itemName">
          <el-input
            v-model="queryParams.itemName"
            placeholder="请输入产品名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item> -->
        <!-- <el-form-item label="截断长" prop="paperLong">
          <el-input
            v-model="queryParams.paperLong"
            placeholder="请输入截断长"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="烫金数" prop="bronzingNum">
          <el-input
            v-model="queryParams.bronzingNum"
            placeholder="请输入烫金数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="分切数" prop="cutting">
          <el-input
            v-model="queryParams.cutting"
            placeholder="请输入分切数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="异常停机超时" prop="abnormalShutdownTimeout">
          <el-input
            v-model="queryParams.abnormalShutdownTimeout"
            placeholder="请输入异常停机超时"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="报废重量/KG" prop="scrapWeight">
          <el-input
            v-model="queryParams.scrapWeight"
            placeholder="请输入报废重量/KG"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="调机换单" prop="changeOrders">
          <el-input
            v-model="queryParams.changeOrders"
            placeholder="请输入调机换单"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="打样套数" prop="sampleNumber">
          <el-input
            v-model="queryParams.sampleNumber"
            placeholder="请输入打样套数"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="生产情况" prop="proSituation">
          <el-input
            v-model="queryParams.proSituation"
            placeholder="请输入生产情况"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="助1" prop="assistant">
          <el-input
            v-model="queryParams.assistant"
            placeholder="请输入助1"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="·" prop="info">
          <el-input
            v-model="queryParams.info"
            placeholder="请输入·"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item> -->
        <el-form-item label="班次" prop="workGroup">
          <el-select v-model="queryParams.workGroup" placeholder="请选择班次" clearable>
            <el-option :label="item.value" :value="item.value"  v-for="item in workGroupList" :key="item.value"/>
          </el-select>
          <!-- <el-input
            v-model="queryParams.workGroup"
            placeholder="请输入班次"
            clearable
            @keyup.enter.native="handleQuery"
          /> -->
        </el-form-item>
        <el-form-item label="报表号" prop="reportNo">
          <el-input
            v-model="queryParams.reportNo"
            placeholder="请输入报表号"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <!-- <el-form-item label="理论产量" prop="theoreticalYield">
          <el-input
            v-model="queryParams.theoreticalYield"
            placeholder="请输入理论产量"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item> -->
        <!-- <el-form-item label="1" prop="one">
          <el-input
            v-model="queryParams.one"
            placeholder="请输入1"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="2" prop="two">
          <el-input
            v-model="queryParams.two"
            placeholder="请输入2"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="3" prop="three">
          <el-input
            v-model="queryParams.three"
            placeholder="请输入3"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="4" prop="four">
          <el-input
            v-model="queryParams.four"
            placeholder="请输入4"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="客户ID" prop="clientId">
          <el-input
            v-model="queryParams.clientId"
            placeholder="请输入客户ID"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="客户编码" prop="clientCode">
          <el-input
            v-model="queryParams.clientCode"
            placeholder="请输入客户编码"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="客户名称" prop="clientName">
          <el-input
            v-model="queryParams.clientName"
            placeholder="请输入客户名称"
            clearable
            @keyup.enter.native="handleQuery"
          />
        </el-form-item>
        <el-form-item label="报工状态(1=草稿,2=已报工)" prop="fbStatus">
          <el-select v-model="queryParams.fbStatus" placeholder="请选择报工状态(1=草稿,2=已报工)" clearable>
            <el-option label="请选择字典生成" value="" />
          </el-select>
        </el-form-item> -->
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
  
      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button
            type="primary"
            plain
            icon="el-icon-plus"
            size="mini"
            @click="handleAdd"
            v-hasPermi="['fb:cutting:add']"
          >新增</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="danger"
            plain
            icon="el-icon-delete"
            size="mini"
            :disabled="multiple"
            @click="handleDelete"
            v-hasPermi="['fb:cutting:remove']"
          >删除</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button
            type="warning"
            plain
            icon="el-icon-download"
            size="mini"
            @click="handleExport"
            v-hasPermi="['fb:cutting:export']"
          >导出</el-button>
        </el-col>
        <el-col :span="1.5">
            <el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport"
                    v-hasPermi="['mes:fb:glue:import']">导入</el-button>
        </el-col>
        <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
      </el-row>
  
      <el-table v-loading="loading" :data="cuttingList" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" align="center" />
        <!-- <el-table-column label="记录ID" align="center" fixed  prop="recordId" /> -->
        <el-table-column label="年" align="center" prop="year" fixed  />
        <el-table-column label="月" align="center" prop="month"  fixed />
        <el-table-column label="日" align="center" prop="day" fixed  />
        <!-- <el-table-column label="上报时间" align="center" prop="reportingDate" width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.reportingDate, '{y}-{m}-{d}') }}</span>
          </template>
        </el-table-column> -->
        <!-- <el-table-column label="原纸卷号" align="center" prop="rollNumber" />
        <el-table-column label="设备ID" align="center" prop="machineryId" /> -->
        <el-table-column label="机台号"  fixed align="center" prop="machineryCode" />
        <!-- <el-table-column label="设备名称" fixed  align="center" prop="machineryName" /> -->
        <el-table-column label="带班" align="center" prop="lead" />
        <!-- <el-table-column label="工单ID" align="center" prop="workorderId" /> -->
        <el-table-column label="工作单号" fixed align="center" prop="workorderId" />
        <!-- <el-table-column label="工单名称" align="center" prop="workorderName" /> -->
        <!-- <el-table-column label="产品ID" align="center" prop="itemId" /> -->
        <el-table-column label="产品编号" align="center" prop="itemCode" />
        <el-table-column label="截断长" align="center" prop="paperLong" />
        <el-table-column label="烫金数" align="center" prop="bronzingNum" />
        <el-table-column label="分切数" align="center" prop="cutting" />
        <el-table-column label="异常停机超时" width="120" align="center" prop="abnormalShutdownTimeout" />
        <el-table-column label="报废重量/KG" width="120" align="center" prop="scrapWeight" />
        <el-table-column label="调机换单" align="center" prop="changeOrders" />
        <el-table-column label="打样套数" align="center" prop="sampleNumber" />
        <el-table-column label="当班生产情况" width="120" align="center" prop="proSituation" />
        <el-table-column label="助1" align="center" prop="assistant" />
        <el-table-column label="·" align="center" prop="info" />
        <el-table-column label="1" align="center" prop="one" />
        <el-table-column label="2" align="center" prop="two" />
        <el-table-column label="3" align="center" prop="three" />
        <el-table-column label="4" align="center" prop="four" />
        <el-table-column label="班次" align="center" prop="workGroup" />
        <el-table-column label="报表号" align="center" prop="reportNo" />
        <el-table-column label="产品名称" align="center" prop="itemName" />
        <el-table-column label="理论产量" align="center" prop="theoreticalYield" />
        <!-- <el-table-column label="客户ID" align="center" prop="clientId" />
        <el-table-column label="客户编码" align="center" prop="clientCode" />
        <el-table-column label="客户名称" align="center" prop="clientName" />
        <el-table-column label="报工状态(1=草稿,2=已报工)" align="center" prop="fbStatus" />
        <el-table-column label="备注" align="center" prop="remark" /> -->
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" >
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
              v-hasPermi="['fb:cutting:edit']"
            >修改</el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"
              v-hasPermi="['fb:cutting:remove']"
            >删除</el-button>
          </template>
        </el-table-column>
      </el-table>
  
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
  
      <!-- 添加或修改烫金分切对话框 -->
      <el-dialog :title="title" :visible.sync="open" width="1100px" append-to-body>
        <el-form ref="form" inline :model="form" :rules="rules" label-width="120px">
          <el-form-item label="年" prop="year">
            <el-input v-model="form.year" type="number" placeholder="请输入年" />
          </el-form-item>
          <el-form-item label="月" prop="month">
            <el-input v-model="form.month" type="number" placeholder="请输入月" />
          </el-form-item>
          <el-form-item label="日" prop="day">
            <el-input v-model="form.day" type="number" placeholder="请输入日" />
          </el-form-item>
          <!-- <el-form-item label="上报时间" class="upTime" prop="reportingDate">
            <el-date-picker clearable
              v-model="form.reportingDate"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="请选择上报时间">
            </el-date-picker>
          </el-form-item> -->
          <!-- <el-form-item label="原纸卷号" prop="rollNumber">
            <el-input v-model="form.rollNumber" placeholder="请输入原纸卷号" />
          </el-form-item> -->
          <!-- <el-form-item label="设备ID" prop="machineryId">
            <el-input v-model="form.machineryId" placeholder="请输入设备ID" />
          </el-form-item> -->
          <el-form-item label="机台号" prop="machineryCode">
            <el-input v-model="form.machineryCode" placeholder="请输入机台号" />
          </el-form-item>
          <el-form-item label="带班" prop="lead">
            <el-input v-model="form.lead" placeholder="请输入带班" />
          </el-form-item>
          <!-- <el-form-item label="设备名称" prop="machineryName">
            <el-input v-model="form.machineryName" placeholder="请输入设备名称" />
          </el-form-item> -->
          <el-form-item label="工作单号" prop="workorderId">
            <el-input v-model="form.workorderId" type="number"   placeholder="请输入工作单号" />
          </el-form-item>
          <!-- <el-form-item label="工单ID" prop="workorderId">
            <el-input v-model="form.workorderId" placeholder="请输入工单ID" />
          </el-form-item> -->

          <!-- <el-form-item label="工单名称" prop="workorderName">
            <el-input v-model="form.workorderName" placeholder="请输入工单名称" />
          </el-form-item> -->
          <!-- <el-form-item label="产品ID" prop="itemId">
            <el-input v-model="form.itemId" placeholder="请输入产品ID" />
          </el-form-item> -->
          <el-form-item label="产品编号" prop="itemCode">
            <el-input v-model="form.itemCode" placeholder="请输入产品编号" />
          </el-form-item>
         
          <el-form-item label="截断长" prop="paperLong">
            <el-input v-model="form.paperLong" type="number"  placeholder="请输入截断长" />
          </el-form-item>
          <el-form-item label="烫金数" prop="bronzingNum">
            <el-input v-model="form.bronzingNum" type="number"  placeholder="请输入烫金数" />
          </el-form-item>
          <el-form-item label="分切数" prop="cutting">
            <el-input v-model="form.cutting" type="number"  placeholder="请输入分切数" />
          </el-form-item>
          <el-form-item label="异常停机超时" prop="abnormalShutdownTimeout">
            <el-input v-model="form.abnormalShutdownTimeout" type="number"  placeholder="请输入异常停机超时" />
          </el-form-item>
          <el-form-item label="报废重量/KG" prop="scrapWeight">
            <el-input v-model="form.scrapWeight" type="number"  placeholder="请输入报废重量/KG" />
          </el-form-item>
          <el-form-item label="调机换单" prop="changeOrders">
            <el-input v-model="form.changeOrders" placeholder="请输入调机换单" />
          </el-form-item>
          <el-form-item label="打样套数" prop="sampleNumber">
            <el-input v-model="form.sampleNumber" type="number"  placeholder="请输入打样套数" />
          </el-form-item>
          <el-form-item label="当班生产情况" prop="proSituation">
            <el-input v-model="form.proSituation" placeholder="请输入当班生产情况" />
          </el-form-item>
          <el-form-item label="助1" prop="assistant">
            <el-input v-model="form.assistant" placeholder="请输入助1" />
          </el-form-item>
          <el-form-item label="·" prop="info">
            <el-input v-model="form.info" placeholder="请输入·" />
          </el-form-item>
          <el-form-item label="1" prop="one">
            <el-input v-model="form.one" placeholder="请输入1" />
          </el-form-item>
          <el-form-item label="2" prop="two">
            <el-input v-model="form.two" placeholder="请输入2" />
          </el-form-item>
          <el-form-item label="3" prop="three">
            <el-input v-model="form.three" placeholder="请输入3" />
          </el-form-item>
          <el-form-item label="4" prop="four">
            <el-input v-model="form.four" placeholder="请输入4" />
          </el-form-item>
          <el-form-item label="班次" prop="workGroup" class="upTime">
            <el-select v-model="form.workGroup" placeholder="请选择班次" clearable>
              <el-option :label="item.value" :value="item.value"  v-for="item in workGroupList" :key="item.value"/>
            </el-select>
          </el-form-item>
          <el-form-item label="报表号" prop="reportNo">
            <el-input v-model="form.reportNo" type="number"  placeholder="请输入报表号" />
          </el-form-item>
           <el-form-item label="产品名称" prop="itemName">
            <el-input v-model="form.itemName" placeholder="请输入产品名称" />
          </el-form-item>
          <el-form-item label="理论产量" prop="theoreticalYield">
            <el-input v-model="form.theoreticalYield" type="number"  placeholder="请输入理论产量" />
          </el-form-item>
         
          <!-- <el-form-item label="客户ID" prop="clientId">
            <el-input v-model="form.clientId" placeholder="请输入客户ID" />
          </el-form-item>
          <el-form-item label="客户编码" prop="clientCode">
            <el-input v-model="form.clientCode" placeholder="请输入客户编码" />
          </el-form-item>
          <el-form-item label="客户名称" prop="clientName">
            <el-input v-model="form.clientName" placeholder="请输入客户名称" />
          </el-form-item>
          <el-form-item label="报工状态(1=草稿,2=已报工)">
            <el-radio-group v-model="form.fbStatus">
              <el-radio label="1">请选择字典生成</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="备注">
            <editor v-model="form.remark" :min-height="192"/>
          </el-form-item> -->
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </el-dialog>
        <!-- 导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
                 :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
                 :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <!-- <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
          </div> -->
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
                   @click="importTemplate">下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
    </div>
  </template>
  
  <script>
  import { listCutting, getCutting, delCutting, addCutting, updateCutting } from "@/api/mes/fb/cutting";
import {getToken} from "@/utils/auth";
import {parseTime} from "@/utils/ruoyi";
  
  export default {
    name: "Cutting",
    data() {
      return {
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        daterangeReportingDate:[],
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 烫金分切表格数据
        cuttingList: [],
        // 弹出层标题
        title: "",
        workGroupList:[
        { value:'A',},
        { value:'B',},
        ],
          // 导入参数
      upload: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: {
          Authorization: "Bearer " + getToken()
        },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/mes/fb/cutting/importData"
      },
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          reportingDate: null,        rollNumber: null,        machineryId: null,        machineryCode: null,        machineryName: null,        lead: null,        workorderId: null,        workorderCode: null,        workorderName: null,        itemId: null,        itemCode: null,        itemName: null,        paperLong: null,        bronzingNum: null,        cutting: null,        abnormalShutdownTimeout: null,        scrapWeight: null,        changeOrders: null,        sampleNumber: null,        proSituation: null,        assistant: null,        info: null,        workGroup: null,        reportNo: null,        theoreticalYield: null,        one: null,        two: null,        three: null,        four: null,        clientId: null,        clientCode: null,        clientName: null,        fbStatus: null,      },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
          year: [
            { required: true, message: "年不能为空", trigger: "blur" }
          ],     
          month: [
            { required: true, message: "月不能为空", trigger: "blur" }
          ],     
          day: [
            { required: true, message: "日不能为空", trigger: "blur" }
          ],        
        },
      };
    },
    created() {
      this.getList();
    },
    methods: {
       /** 下载模板操作 */
    importTemplate() {
      // this.download('/mes/fb/flow/importTemplate', {}, `fbReel_template_${new Date().getTime()}.xlsx`)
      this.download('/mes/fb/cutting/importTemplate', {}, `烫金分切报表模板.xlsx`)
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
            /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "报表导入";
      this.upload.open = true;
    },
      /** 查询烫金分切列表 */
      getList() {
        this.loading = true;
        this.queryParams.params = {};
        if (null != this.daterangeReportingDate && '' != this.daterangeReportingDate) {
            this.queryParams.params["beginReportingDate"] = this.daterangeReportingDate[0];
            this.queryParams.params["endReportingDate"] = this.daterangeReportingDate[1];
        }
        listCutting(this.queryParams).then(response => {
          this.cuttingList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      // 表单重置
      reset() {
        this.form = {
          recordId: null,   year: null, month: null, day: null,      reportingDate: null,        rollNumber: null,        machineryId: null,        machineryCode: null,        machineryName: null,        lead: null,        workorderId: null,        workorderCode: null,        workorderName: null,        itemId: null,        itemCode: null,        itemName: null,        paperLong: null,        bronzingNum: null,        cutting: null,        abnormalShutdownTimeout: null,        scrapWeight: null,        changeOrders: null,        sampleNumber: null,        proSituation: null,        assistant: null,        info: null,        workGroup: null,        reportNo: null,        theoreticalYield: null,        one: null,        two: null,        three: null,        four: null,        clientId: null,        clientCode: null,        clientName: null,        fbStatus: 0,        remark: null,        delFlag: null,        createBy: null,        createTime: null,        updateBy: null,        updateTime: null      };
        this.resetForm("form");
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.daterangeReportingDate = [];
        this.resetForm("queryForm");
        this.handleQuery();
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.recordId)
        this.single = selection.length!==1
        this.multiple = !selection.length
      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset();
        this.open = true;
        this.title = "添加烫金分切";
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset();
        const recordId = row.recordId || this.ids
        getCutting(recordId).then(response => {
          this.form = response.data;
          this.open = true;
          this.title = "修改烫金分切";
        });
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs["form"].validate(valid => {
          if (valid) {
            if (this.form.recordId != null) {
              updateCutting(this.form).then(response => {
                this.$modal.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              });
            } else {
              addCutting(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            }
          }
        });
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const recordIds = row.recordId || this.ids;
        this.$modal.confirm('是否确认删除烫金分切编号为"' + recordIds + '"的数据项？').then(function() {
          return delCutting(recordIds);
        }).then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        }).catch(() => {});
      },
      /** 导出按钮操作 */
      handleExport() {
        this.beforeExportFn();
        this.download('mes/fb/cutting/export', {
          ...this.queryParams
        }, `烫金分切日报_${parseTime(new Date().getTime(), '{y}-{m}-{d}-{h}')}.xlsx`)
      }
    }
  };
  </script>
   <style scoped>
   .upTime >>> .el-input{
     width: 201px;
   }
   </style>
  